<template>
    <div class="maincontent">
        <h3 class="title" style="text-align:center;">
            成果初审意见表
        </h3>
        <div style="clear:both;"></div>
        <div class="downloadimg">
            <iframe
                class="pdfBox"
                :src="pdfUrl"
                ></iframe>
            <div v-if="!pdfUrl" style="text-align:center;margin-top:100px">
              暂未生成审查意见表
            </div>
        </div>
    </div>
</template>

<script>
import pdf from "vue-pdf";
import { getAdvicePdf } from "@/api/feasibilityStudy/common.js"
export default {
    components:{
        pdf
    },
    data() {
        return {
            projectId:localStorage.getItem('projectId'),
            pdfUrl:"",
            numPages:0
        };
    },
    
    created() {
        this.getInitData();
    },
    methods: {
        //初始化
        getInitData:function () {
            this.getAdvicePdf();
        },
        getAdvicePdf:function () {
            const loading = this.$loading({
                lock: true,
                text: "Loading",
                spinner: "el-icon-loading",
                background: "rgba(0, 0, 0, 0.7)"
            });
            let params = {
                projectId:this.projectId,
                groupId:1,
                type:0,
            };
            getAdvicePdf(params).then(res => {
              loading.close();
                if(res.data){
                    this.pdfUrl = this.$config.baseUrl + res.data;
                }
            })
        },
    }
};
</script>

<style lang="scss" scoped>
    .maincontent{
        padding: 20px 200px;
        .printbtn{
            width:82px;
            height:36px;
            float: right;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size:14px;
            font-family:PingFang SC;
            font-weight:500;
            color: #4d4d4d;
            cursor: pointer;
            background: #ffffff;
            border-radius: 4px;
            img{
                width: 14px;
                margin-right: 5px;
            }
        }
        .downloadimg{
            margin-top: 30px;
            img{
                width: 100%;
                display: block;
            };
            .pdfBox{
                width:100%;
                border: 1px solid rgba(0,0,0,.05);
                height: calc(100vh - 250px);
            }
        }
    }
</style>
 